import { IPSAppDEMultiDataView } from './ipsapp-demulti-data-view';
import { PSAppDEXDataViewImpl } from './psapp-dexdata-view-impl';
import { IPSCodeList } from '../../codelist/ipscode-list';

export class PSAppDEMultiDataViewImpl extends PSAppDEXDataViewImpl implements IPSAppDEMultiDataView {
  protected quickgrouppscodelist: IPSCodeList | null = null;

  getQuickGroupPSCodeList(): IPSCodeList | null {
    if (this.quickgrouppscodelist != null) return this.quickgrouppscodelist;
    const value = this.M.getQuickGroupPSCodeList;
    if (value == null) {
      return null;
    }
    this.quickgrouppscodelist = this.getPSModel4('codelist.IPSCodeList', value, 'getQuickGroupPSCodeList') as IPSCodeList;
    return this.quickgrouppscodelist;
  }

  get quickGroupPSCodeList(): IPSCodeList | null {
    return this.getQuickGroupPSCodeList();
  }

  getQuickGroupPSCodeListMust(): IPSCodeList {
    const value = this.getQuickGroupPSCodeList();
    if (value == null) {
      throw new Error('未指定快速分组代码表');
    }
    return value;
  }

  get enableEditData(): boolean {
    return this.M.enableEditData;
  }

  get enableExport(): boolean {
    return this.M.enableExport != null ? this.M.enableExport : false;
  }

  get enableFilter(): boolean {
    return this.M.enableFilter;
  }

  get enableImport(): boolean {
    return this.M.enableImport != null ? this.M.enableImport : false;
  }

  get enableNewData(): boolean {
    return this.M.enableNewData;
  }

  get enableQuickCreate(): boolean {
    return this.M.enableQuickCreate;
  }

  get enableQuickGroup(): boolean {
    return this.M.enableQuickGroup != null ? this.M.enableQuickGroup : false;
  }

  get enableQuickSearch(): boolean {
    return this.M.enableQuickSearch != null ? this.M.enableQuickSearch : false;
  }

  get enableSearch(): boolean {
    return this.M.enableSearch != null ? this.M.enableSearch : false;
  }

  get enableViewData(): boolean {
    return this.M.enableViewData;
  }

  get expandSearchForm(): boolean {
    return this.M.expandSearchForm != null ? this.M.expandSearchForm : false;
  }

  get pickupMode(): boolean {
    return this.M.pickupMode != null ? this.M.pickupMode : false;
  }

  get cls(): string {
    return 'PSAppDEMultiDataViewImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.view.IPSAppDEMultiDataView' || cls == 'app.view.IPSAppDESearchView' || cls == 'app.view.IPSAppDESearchView2' || cls == 'control.IPSControlMDataContainer') return true;
    return super.instanceof(cls);
  }
}
